package work20241203_chap6oop.l_demo9_new;

import work20241203_chap6oop.k_demo9.Role;

/**
 * @author zdl
 * @date 2024/12/3
 */
public class Magicer1 extends Role {
    private int level;

    public Magicer1() {
    }

    public Magicer1(int level) {
        this.level = level;
    }

    public Magicer1(String name, int level) {
        super(name);
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        if (level >= 1 && level <= 10) {
            this.level = level;
        } else {
            System.out.println("魔法等级在1-10之间");
        }
    }

    @Override
    public int attack() {
        int magNum = 5;
        return magNum * level;
    }
}
